﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using DSPL.Common;
using DSPL.Common.CommonForms;
using DSPL.Common.ViewModel;
using DSPL.Contracts.Common;
using DSPL.Contracts.Interfaces;
using DSPL.Finac.View;
using DSPL.Finac.ViewModel;
using Microsoft.Practices.Unity;
using DSPL.Services.Rules;
using System.Windows.Forms;
using System.Diagnostics;

namespace DSPL.Finac
{
    /// <summary>
    /// Interaction logic for FinacWindow.xaml
    /// </summary>
    public partial class FinacWindow : Window
    {
        public FinacWindow()
        {
            InitializeComponent();
            ResolveDependencies(GlobalVariables.GlobalUnityContainer);
        }

        IMessageService MessageService;

        private void ResolveDependencies(IUnityContainer container)
        {
            if (container != null)
            {
                MessageService = container.Resolve<IMessageService>(); 
            }
        }

        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            //AreaMasterView tobj = new AreaMasterView();
            ////ListWindow tobj = new ListWindow();
            //tobj.Show();


            MessageService.ShowWindow(new AreaMasterViewModel());
        }

        private void ClickLocationMaster(object sender, EventArgs e)
        {
          //  new DSPL.Finac.View.LocationMasterView().Show();
             MessageService.ShowWindow(new LocationMasterViewModel());
        }
        

        private void ClickSupplierMaster(object sender, EventArgs e)
        {
            //new SupplierMasterView().ShowDialog();
            MessageService.ShowWindow(new SupplierMasterViewModel());
        }

        private void ClickList(object sender, RoutedEventArgs e)
        {
            ListWindowViewModel vmListWindow = new ListWindowViewModel();
            vmListWindow.TableName = "fUnit";
            vmListWindow.Initialize();
            MessageService.ShowPopupWindow(vmListWindow);
        }

        private void ClickFilter(object sender, RoutedEventArgs e)
        {
            
        }

        private void ProductGroupClick(object sender,EventArgs e)
        {
            Stopwatch s = Stopwatch.StartNew();
            //new DSPL.Finac.View.ProductGroupMasterView().Show(); 
            MessageService.ShowWindow(new ProductGroupViewModel());
            s.Stop();
            long ss = s.ElapsedMilliseconds;
        }

        private void ProductMasterClick(object sender, EventArgs e)
        {
            //new DSPL.Finac.View.ProductMasterView().Show();
            MessageService.ShowWindow(new ProductMasterViewModel());
        }

        private void ProductTypeClick(object sender, EventArgs e)
        {
          //  new DSPL.Finac.View.ProductTypeMasterView().Show();
            MessageService.ShowWindow(new ProductTypeMasterViewModel());
        }
        private void UOMClick(object sender, EventArgs e)
        {
           // new DSPL.Finac.View.UnitOfMeasureMasterView().Show();
            MessageService.ShowWindow(new UnitOfMeasureMasterViewModel());
        }

        private void ReasonClick(object sender, EventArgs e)
        {
           // new DSPL.Finac.View.ReasonMasterView().Show();
            MessageService.ShowWindow(new ReasonMasterViewModel());
        }

        private void CardTypeClick(object sender, EventArgs e)
        {
            //new DSPL.Finac.View.CardTypeMasterView().Show();
            MessageService.ShowWindow(new CardTypeMasterViewModel());
        }

        private void SupplierGroupClick(object sender, EventArgs e)
        {
            //new DSPL.Finac.View.SupplierGroupMasterView().Show();
            MessageService.ShowWindow(new SupplierGroupMasterViewModel());

        }

        private void CustomerGroupClick(object sender, EventArgs e)
        {
            //new DSPL.Finac.View.CustomerGroupMasterView().Show();
            MessageService.ShowWindow(new CustomerGroupMasterViewModel());
        }

        private void RankClick(object sender, EventArgs e)
        {
           // new DSPL.Finac.View.RankMasterView().Show();
            MessageService.ShowWindow(new RankMasterViewModel());
        }

        private void SalesRepClick(object sender, EventArgs e)
        {
            // new DSPL.Finac.View.RankMasterView().Show();
            MessageService.ShowWindow(new SalesRepMasterViewModel());
        }

        private void CustomerClick(object sender, EventArgs e)
        {
            // new DSPL.Finac.View.RankMasterView().Show();
            MessageService.ShowWindow(new CustomerMasterViewModel());
        }

        private void TaxClick(object sender, EventArgs e)
        {
            // new DSPL.Finac.View.RankMasterView().Show();
            MessageService.ShowWindow(new TaxMasterViewModel());
        }

        private void PurchaseOrderClick(object sender, EventArgs e)
        {
            MessageService.ShowWindow(new PurchaseOrderViewModel());
        }


        private void GoodReceiveNoteClick(object sender, EventArgs e)
        {
            MessageService.ShowWindow(new GoodReceiveNoteViewModel());
        }

        private void GoodReceiveReturnNoteClick(object sender, EventArgs e)
        {
            MessageService.ShowWindow(new GoodReceiveReturnViewModel());
        }

        private void QuotationClick(object sender, EventArgs e)
        {
            MessageService.ShowWindow(new QuotationViewModel());
        }
       
        private void SalesOrderClick(object sender, EventArgs e)
        {
            MessageService.ShowWindow(new SalesOrderViewModel());
        }

        private void InvoiceClick(object sender, EventArgs e)
        {
            MessageService.ShowWindow(new InvoiceViewModel());
        }

        private void DispatchNoteClick(object sender, EventArgs e)
        {
            MessageService.ShowWindow(new DispatchNoteViewModel());
        }

        private void SalesReturnWithInvoiceClick(object sender, EventArgs e)
        {
            MessageService.ShowWindow(new SalesReturnWithInvoiceViewModel());
        }

        private void SalesReturnWithOutInvoiceClick(object sender, EventArgs e)
        {
            MessageService.ShowWindow(new SalesReturnWithOutInvoiceViewModel());
        }

        private void InterLocationTransferClick(object sender, EventArgs e)
        {
            MessageService.ShowWindow(new InterLocStockTransferViewModel());
        }

        private void DamageStockClick(object sender, EventArgs e)
        {
            MessageService.ShowWindow(new DamageStockTransferViewModel());
        }

        private void IssueNoteClick(object sender, EventArgs e)
        {
            MessageService.ShowWindow(new IssueNoteViewModel());
        }

        private void IssueReturnNoteClick(object sender, EventArgs e)
        {
            MessageService.ShowWindow(new IssueReturnNoteViewModel());
        }


        private void AdjustmentAddClick(object sender, EventArgs e)
        {
            MessageService.ShowWindow(new AdjustmentAdditionViewModel());
        }

        private void AdjustmentDeducClick(object sender, EventArgs e)
        {
            MessageService.ShowWindow(new AdjustmentDeductionViewModel());
        }

        private void StockRulesClick(object sender, EventArgs e)
        {
            var testStockRules = new TestStockRules();
            testStockRules.TestRules();
           
       
        }

        private void CurrencyClick(object sender, EventArgs e)
        {
            MessageService.ShowWindow(new CurrencyMasterViewModel());
        }

        private void PriceLevelClick(object sender, EventArgs e)
        {
            MessageService.ShowWindow(new PriceLevelMasterViewModel());
        }

        private void TaxCombClick(object sender, EventArgs e)
        {
            MessageService.ShowWindow(new TaxCombinationMasterViewModel());
        }

        private void CostCentreClick(object sender, EventArgs e)
        {
            MessageService.ShowWindow(new CostCentreMasterViewModel());
        }

        private void CardTypeClick(object sender, RoutedEventArgs e)
        {
            MessageService.ShowWindow(new CardTypeMasterViewModel());
        }

        private void CmdSalesRepTest_Click_1(object sender, RoutedEventArgs e)
        {
            MessageService.ShowWindow(new SalesRepTestModel());
        }

    }
}
